package com.aube.plugin.draw;

import java.io.Serializable;
import java.util.LinkedHashMap;

/**
 * Created by huyaonan on 16/8/12.
 */
public class DrawModel implements Serializable {

    public String drawDesc;
    public String drawUrl;
    public String drawFlag;
    public String detailUrl;

    public String picUrl;
    public int width;
    public int height;

    public void setItem(String key, Object value) {
        if(value == null)
            return;
        try {
            if ("drawDesc".equalsIgnoreCase(key)) {
                drawDesc = (String) value;
            } else if ("picInfo".equalsIgnoreCase(key)) {
                LinkedHashMap<String, Object> lhm = (LinkedHashMap<String, Object>) value;
                if(value != null) {
                    picUrl = (String) lhm.get("picurl");
                    width = (int) ((double) lhm.get("width"));
                    height = (int) ((double) lhm.get("height"));
                }
            } else if ("drawUrl".equalsIgnoreCase(key)) {
                drawUrl = (String) value;
            } else if ("drawFlag".equalsIgnoreCase(key)) {
                drawFlag = (String) value;
            } else if ("detailUrl".equalsIgnoreCase(key)) {
                detailUrl = (String) value;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
